package com.dou.controller;

import com.dou.dto.Dto;
import com.dou.dto.DtoUtil;
import com.dou.entity.Seckill;
import com.dou.service.SeckillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("seckill")
public class SeckillController {
    /***
     * 服务对象
     */
    @Autowired
    private SeckillService seckillService;
    @PostMapping("createSeckill")
    public Dto createSeckill(@RequestBody Seckill seckill){
        int result=seckillService.addSeckieGoods(seckill);
        if(result>0){
            return DtoUtil.returnSuccess();
        }else {
            return DtoUtil.returnFail("添加秒杀失败","4001");
        }
    }
    @GetMapping("hello")
    public String  hello(){
        return "hello";
    }
}
